package org.example.coursemangementserver.server.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.example.coursemangementserver.pojo.entity.Course;
import org.example.coursemangementserver.pojo.vo.course.CourseIdWithName.CourseIdWithNameVO;
import org.example.coursemangementserver.pojo.vo.course.CourseList.CourseVO;
import org.example.coursemangementserver.pojo.vo.course.SelectCourseStatistics.SelectCourseStatisticVO;
import org.example.coursemangementserver.pojo.vo.course.TeacherCourseList.TeacherCourseVO;

import java.util.List;


/**
 * @author 12438
 */
public interface CourseMapper extends BaseMapper<Course> {

    /**
     * 根据条件查询课程表中的符合条件的数据的总数
     * @param name 课程名
     * @return
     */
    Integer getCourseTotal(@Param("name") String name);

    /**
     * 根据条件分页查询
     * @param start
     * @param pageSize
     * @param name
     * @return
     */
    List<CourseVO> getCourseList(@Param("start") Integer start,
                                 @Param("pageSize") Integer pageSize,
                                 @Param("name") String name);

    /**
     * 获取该老师的课程数
     * @param teacherId
     * @param name
     * @return
     */
    Integer getTeacherCourseTotal(@Param("teacherId") Long teacherId, @Param("name") String name);

    /**
     * 获取该老师的所有课程信息
     * @param start
     * @param pageSize
     * @param teacherId
     * @param name
     * @return
     */
    List<TeacherCourseVO> getTeacherCourseList(@Param("start") Integer start, @Param("pageSize") Integer pageSize, @Param("teacherId") Long teacherId, @Param("name") String name);

    /**
     * 根据课程id查询课程详情
     * @param courseId
     * @return
     */
    @Select("select * from course where course_id = #{courseId}")
    Course getCourseById(Long courseId);

    List<CourseIdWithNameVO> getCourseIdWithName();
}
